package org.fioma.search;

import java.util.Stack;

public class MatchReadCollectionFactory {

	int maxSize = 0;
	int c, j, k;

	Stack<MatchReadCollection> MatchReadCollections = new Stack<MatchReadCollection>();

	public MatchReadCollectionFactory(int maxSize, int k, int c, int j) {
		this.maxSize = maxSize;
		this.k = k;
		this.c = c;
		this.j = j;
	}

	public MatchReadCollection getMatchCollection() {
		if (MatchReadCollections.empty()) {
			MatchReadCollections.add(new MatchReadCollectionImpl(maxSize, k, c, j));
		}
		return MatchReadCollections.pop();
	}

	public void freeMatchCollection(MatchReadCollection matchCollection) {
		matchCollection.clear();
		MatchReadCollections.push(matchCollection);
	}
}
